package com.wangtao.firstapp.utils;

import android.content.Context;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.wangtao.firstapp.R;

/**
 * Created by lanouhn on 16/9/13.
 */
public class CommentsDialogUtils {

    private Context context;
    private AlertDialog.Builder aBuilder;
    private AlertDialog alertDialog;



    public void commentsDialog(Context context,View.OnClickListener cdonClickListener) {

        aBuilder=new AlertDialog.Builder(context);
        View view = LayoutInflater.from(context).inflate(R.layout.comments_dialog, null);
        aBuilder.setView(view);
        aBuilder.setCancelable(false);
        alertDialog = aBuilder.create();

//        Window window = alertDialog.getWindow();
//
//        WindowManager.LayoutParams lp = window.getAttributes();
//        lp.gravity = Gravity.CENTER;
//        lp.width = 150;//宽高可设置具体大小
//        lp.height = 200;
//        alertDialog.getWindow().setAttributes(lp);

        TextView reply = (TextView) view.findViewById(R.id.reply_comments_dialog);//回复
        TextView copy = (TextView) view.findViewById(R.id.copy_comments_dialog);//复制
        TextView callof = (TextView) view.findViewById(R.id.callof_comments_dialog);//取消
        TextView report= (TextView) view.findViewById(R.id.report_comments_dialog);//举报
        View reportView=view.findViewById(R.id.reportView_comments_dialog);//举报下的线

        reply.setOnClickListener(cdonClickListener);
        copy.setOnClickListener(cdonClickListener);
        callof.setOnClickListener(cdonClickListener);
        report.setOnClickListener(cdonClickListener);
        alertDialog.show();
    }



    //回复
    public void replyCD() {
        alertDialog.cancel();
    }

    //复制
    public void copyCD() {
        alertDialog.cancel();
    }

    public void reportCd(){
        alertDialog.cancel();
    }

    //取消
    public void callofCD() {
        alertDialog.cancel();
    }
}
